home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 72 / IOPROG_72.ISO / soft / c++ / NCTDiscWriter2.exe / {app} / MS VB.Net Samples / TestVBNETDataCDWriter / frmDiscInfo.vb < prev    next >
Encoding:
Text File  |  2002-12-10  |  9.8 KB  |  245 lines

  1. Public Class frmDiscInfo
  2.     Inherits System.Windows.Forms.Form
  3.     Public frm As Form1
  4.  
  5. #Region " Windows Form Designer generated code "
  6.  
  7.     Public Sub New()
  8.         MyBase.New()
  9.  
  10.         'This call is required by the Windows Form Designer.
  11.         InitializeComponent()
  12.  
  13.         'Add any initialization after the InitializeComponent() call
  14.  
  15.     End Sub
  16.  
  17.     'Form overrides dispose to clean up the component list.
  18.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  19.         If disposing Then
  20.             If Not (components Is Nothing) Then
  21.                 components.Dispose()
  22.             End If
  23.         End If
  24.         MyBase.Dispose(disposing)
  25.     End Sub
  26.  
  27.     'Required by the Windows Form Designer
  28.     Private components As System.ComponentModel.IContainer
  29.  
  30.     'NOTE: The following procedure is required by the Windows Form Designer
  31.     'It can be modified using the Windows Form Designer.  
  32.     'Do not modify it using the code editor.
  33.     Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
  34.     Friend WithEvents cdUsedSpaceLbl As System.Windows.Forms.Label
  35.     Friend WithEvents cdStatusLbl As System.Windows.Forms.Label
  36.     Friend WithEvents cdTypeLbl As System.Windows.Forms.Label
  37.     Friend WithEvents Label3 As System.Windows.Forms.Label
  38.     Friend WithEvents Label2 As System.Windows.Forms.Label
  39.     Friend WithEvents Label1 As System.Windows.Forms.Label
  40.     Friend WithEvents cdEstUsedSpaceLbl As System.Windows.Forms.Label
  41.     Friend WithEvents Label5 As System.Windows.Forms.Label
  42.     Friend WithEvents RefreshBtn As System.Windows.Forms.Button
  43.     Friend WithEvents EjectBtn As System.Windows.Forms.Button
  44.     Friend WithEvents OKBtn As System.Windows.Forms.Button
  45.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  46.         Me.GroupBox1 = New System.Windows.Forms.GroupBox()
  47.         Me.cdEstUsedSpaceLbl = New System.Windows.Forms.Label()
  48.         Me.Label5 = New System.Windows.Forms.Label()
  49.         Me.cdUsedSpaceLbl = New System.Windows.Forms.Label()
  50.         Me.cdStatusLbl = New System.Windows.Forms.Label()
  51.         Me.cdTypeLbl = New System.Windows.Forms.Label()
  52.         Me.Label3 = New System.Windows.Forms.Label()
  53.         Me.Label2 = New System.Windows.Forms.Label()
  54.         Me.Label1 = New System.Windows.Forms.Label()
  55.         Me.RefreshBtn = New System.Windows.Forms.Button()
  56.         Me.EjectBtn = New System.Windows.Forms.Button()
  57.         Me.OKBtn = New System.Windows.Forms.Button()
  58.         Me.GroupBox1.SuspendLayout()
  59.         Me.SuspendLayout()
  60.         '
  61.         'GroupBox1
  62.         '
  63.         Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.cdEstUsedSpaceLbl, Me.Label5, Me.cdUsedSpaceLbl, Me.cdStatusLbl, Me.cdTypeLbl, Me.Label3, Me.Label2, Me.Label1})
  64.         Me.GroupBox1.Location = New System.Drawing.Point(3, 8)
  65.         Me.GroupBox1.Name = "GroupBox1"
  66.         Me.GroupBox1.Size = New System.Drawing.Size(337, 126)
  67.         Me.GroupBox1.TabIndex = 0
  68.         Me.GroupBox1.TabStop = False
  69.         Me.GroupBox1.Text = "Disc Total"
  70.         '
  71.         'cdEstUsedSpaceLbl
  72.         '
  73.         Me.cdEstUsedSpaceLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  74.         Me.cdEstUsedSpaceLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
  75.         Me.cdEstUsedSpaceLbl.Location = New System.Drawing.Point(134, 97)
  76.         Me.cdEstUsedSpaceLbl.Name = "cdEstUsedSpaceLbl"
  77.         Me.cdEstUsedSpaceLbl.Size = New System.Drawing.Size(191, 18)
  78.         Me.cdEstUsedSpaceLbl.TabIndex = 13
  79.         Me.cdEstUsedSpaceLbl.Text = "0"
  80.         Me.cdEstUsedSpaceLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  81.         '
  82.         'Label5
  83.         '
  84.         Me.Label5.Location = New System.Drawing.Point(14, 99)
  85.         Me.Label5.Name = "Label5"
  86.         Me.Label5.Size = New System.Drawing.Size(104, 15)
  87.         Me.Label5.TabIndex = 12
  88.         Me.Label5.Text = "Est. Space:"
  89.         '
  90.         'cdUsedSpaceLbl
  91.         '
  92.         Me.cdUsedSpaceLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  93.         Me.cdUsedSpaceLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
  94.         Me.cdUsedSpaceLbl.Location = New System.Drawing.Point(134, 73)
  95.         Me.cdUsedSpaceLbl.Name = "cdUsedSpaceLbl"
  96.         Me.cdUsedSpaceLbl.Size = New System.Drawing.Size(191, 18)
  97.         Me.cdUsedSpaceLbl.TabIndex = 11
  98.         Me.cdUsedSpaceLbl.Text = "0"
  99.         Me.cdUsedSpaceLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  100.         '
  101.         'cdStatusLbl
  102.         '
  103.         Me.cdStatusLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  104.         Me.cdStatusLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
  105.         Me.cdStatusLbl.Location = New System.Drawing.Point(134, 49)
  106.         Me.cdStatusLbl.Name = "cdStatusLbl"
  107.         Me.cdStatusLbl.Size = New System.Drawing.Size(191, 18)
  108.         Me.cdStatusLbl.TabIndex = 10
  109.         Me.cdStatusLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  110.         '
  111.         'cdTypeLbl
  112.         '
  113.         Me.cdTypeLbl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
  114.         Me.cdTypeLbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
  115.         Me.cdTypeLbl.Location = New System.Drawing.Point(134, 26)
  116.         Me.cdTypeLbl.Name = "cdTypeLbl"
  117.         Me.cdTypeLbl.Size = New System.Drawing.Size(192, 18)
  118.         Me.cdTypeLbl.TabIndex = 9
  119.         Me.cdTypeLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight
  120.         '
  121.         'Label3
  122.         '
  123.         Me.Label3.Location = New System.Drawing.Point(14, 76)
  124.         Me.Label3.Name = "Label3"
  125.         Me.Label3.Size = New System.Drawing.Size(104, 15)
  126.         Me.Label3.TabIndex = 8
  127.         Me.Label3.Text = "Used Space:"
  128.         '
  129.         'Label2
  130.         '
  131.         Me.Label2.Location = New System.Drawing.Point(14, 52)
  132.         Me.Label2.Name = "Label2"
  133.         Me.Label2.Size = New System.Drawing.Size(104, 15)
  134.         Me.Label2.TabIndex = 7
  135.         Me.Label2.Text = "Status:"
  136.         '
  137.         'Label1
  138.         '
  139.         Me.Label1.Location = New System.Drawing.Point(14, 29)
  140.         Me.Label1.Name = "Label1"
  141.         Me.Label1.Size = New System.Drawing.Size(104, 15)
  142.         Me.Label1.TabIndex = 6
  143.         Me.Label1.Text = "Type:"
  144.         '
  145.         'RefreshBtn
  146.         '
  147.         Me.RefreshBtn.Location = New System.Drawing.Point(352, 12)
  148.         Me.RefreshBtn.Name = "RefreshBtn"
  149.         Me.RefreshBtn.Size = New System.Drawing.Size(105, 18)
  150.         Me.RefreshBtn.TabIndex = 1
  151.         Me.RefreshBtn.Text = "Refresh"
  152.         '
  153.         'EjectBtn
  154.         '
  155.         Me.EjectBtn.Location = New System.Drawing.Point(351, 37)
  156.         Me.EjectBtn.Name = "EjectBtn"
  157.         Me.EjectBtn.Size = New System.Drawing.Size(105, 18)
  158.         Me.EjectBtn.TabIndex = 3
  159.         Me.EjectBtn.Text = "Eject"
  160.         '
  161.         'OKBtn
  162.         '
  163.         Me.OKBtn.Location = New System.Drawing.Point(350, 116)
  164.         Me.OKBtn.Name = "OKBtn"
  165.         Me.OKBtn.Size = New System.Drawing.Size(105, 18)
  166.         Me.OKBtn.TabIndex = 4
  167.         Me.OKBtn.Text = "OK"
  168.         '
  169.         'frmDiscInfo
  170.         '
  171.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  172.         Me.ClientSize = New System.Drawing.Size(459, 144)
  173.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.OKBtn, Me.EjectBtn, Me.RefreshBtn, Me.GroupBox1})
  174.         Me.MaximizeBox = False
  175.         Me.MinimizeBox = False
  176.         Me.Name = "frmDiscInfo"
  177.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  178.         Me.Text = "frmDiscInfo"
  179.         Me.GroupBox1.ResumeLayout(False)
  180.         Me.ResumeLayout(False)
  181.  
  182.     End Sub
  183.  
  184. #End Region
  185.  
  186.     Private Sub frmDiscInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  187.         frm = Me.Owner
  188.         RefreshFormData()
  189.     End Sub
  190.     Private Sub RefreshFormData()
  191.         frm.RefreshDiskInfo()
  192.  
  193.         cdUsedSpaceLbl.Text = Format((frm.DataCDWriter1.cdUsedSpace / 1024) / 1024, "#0.000") & " MB"
  194.         cdEstUsedSpaceLbl.Text = Format((frm.DataCDWriter1.GetDataVolumeBurnSize / 1024) / 1024, "#0.000") & " MB"
  195.  
  196.         Select Case frm.DataCDWriter1.cdType
  197.             Case NCTDISCWRITERLib.CD_TYPE.WRITEONCE
  198.                 cdTypeLbl.Text = "CD-R, CD-ROM"
  199.                 EjectBtn.Enabled = True
  200.  
  201.             Case NCTDISCWRITERLib.CD_TYPE.ERASABLE
  202.                 cdTypeLbl.Text = "CD-RW"
  203.                 EjectBtn.Enabled = True
  204.  
  205.  
  206.             Case NCTDISCWRITERLib.CD_TYPE.RANDOMACCESS
  207.                 cdTypeLbl.Text = "DVD-RAM"
  208.                 EjectBtn.Enabled = True
  209.  
  210.             Case NCTDISCWRITERLib.CD_TYPE.NODISC
  211.                 cdTypeLbl.Text = "No Disc"
  212.                 EjectBtn.Enabled = False
  213.                 cdUsedSpaceLbl.Text = "0"
  214.  
  215.         End Select
  216.  
  217.         Select Case frm.DataCDWriter1.cdStatus
  218.             Case NCTDISCWRITERLib.CD_STATUS.BLANK
  219.                 cdStatusLbl.Text = "Blank"
  220.                 cdUsedSpaceLbl.Text = "0"
  221.             Case NCTDISCWRITERLib.CD_STATUS.WRITEBLE
  222.                 cdStatusLbl.Text = "Open"
  223.             Case NCTDISCWRITERLib.CD_STATUS.NOTWRITEBLE
  224.                 cdStatusLbl.Text = "Closed"
  225.             Case NCTDISCWRITERLib.CD_STATUS.UNRECOGNIZED
  226.                 cdStatusLbl.Text = "Unknown"
  227.                 cdUsedSpaceLbl.Text = "0"
  228.         End Select
  229.     End Sub
  230.  
  231.     Private Sub RefreshBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshBtn.Click
  232.         RefreshFormData()
  233.     End Sub
  234.  
  235.     Private Sub EjectBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EjectBtn.Click
  236.         frm.DataCDWriter1.Eject()
  237.         frm.RefreshDiskInfo()
  238.         RefreshFormData()
  239.     End Sub
  240.  
  241.     Private Sub OKBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKBtn.Click
  242.         Me.Hide()
  243.     End Sub
  244. End Class
  245.